package graph.element.shape;
import graph.GraphPanel;
import graph.color.Color;

import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Ellipse2D;

public class Circle extends Shape {

	private double radius;
	
	public Circle(GraphPanel graphingData, boolean value, Color color, double x, double y, int xInc, int yInc, int val, int max) {
		super(graphingData, x, y, value, color, val, max);
		double maxRadius = Math.min(xInc/2, yInc/2) -1;
		double scale = (double) maxRadius / (double) max;
		this.radius = val * scale;
	}
	public void draw() {
		Graphics g = getG();
		Graphics2D g2 = (Graphics2D)g;
		Ellipse2D circle = new Ellipse2D.Double();
	    circle.setFrameFromCenter(x, y, x + radius, y + radius);
	    java.awt.Color restore = g2.getColor();
	    g2.setColor(this.color);
	    g2.fill(circle);
	    g2.setColor(restore);
	    drawValue();
	}
}
